<template>
  <div>
    <ZgEdit
      ref="dialog"
      :view="view"
      :columns="columns"
      :formulas="formulas"
      :inputClick="inputClick"
      validUrl=""
      saveUrl=""
      @ok="$emit('ok')"
    >
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data() {
    return {
      view: { width: '60%', top: '5%', title: '新增供应链' },
      type: 'add',
      obj: null,
      columns: [
        {
          name: '文本',
          code: 'text',
          compType: '文本',
          isNeed: true,
          offset: 0,
          span: 24,
          defaultVal:
            '新增：页面信息同认证页面信息，搜索信用代码时需查询当前用户是否被交易和物流同步至本系统，若已同步，则回显信息后填写下方内容，若未同步，则提示用户未在焦煤系统中注册'
        },
        {
          name: '文本',
          code: 'text',
          compType: '文本',
          isNeed: true,
          offset: 0,
          span: 24,
          defaultVal: '修改：同融资企业基础信息修改页面，若当前本单位有变更和注册待办，不能发起修改'
        }
      ],
      formulas: [
        { triggerMode: '初始化时', name: '公式1', content: 'console.log("init");' },
        { triggerMode: '数据变化时', name: '公式2', content: 'console.log("update");' },
        { triggerMode: '提交时', name: '公式3', content: 'console.log("submit");' }
      ]
    }
  },
  methods: {
    open(type, json) {
      this.type = type
      let title
      if (type === 'add') {
        title = '新增'
      } else if (type === 'edit') {
        title = '编辑'
      } else {
        title = '详情'
      }
      this.view = { width: '60%', top: '5%', title: title }
      this.obj = Object.assign({}, this.obj, json || {})
      this.$refs.dialog.open()
    },
    inputClick(t) {
      alert(JSON.stringify(t))
    }
  }
}
</script>

<style lang="scss" scoped></style>
